package a5;

public class PrimeNumbers {

	
	public static void main(String[] args) {
		int max=1000;
		boolean prime;
		for(int i=2 ,j=1 ; i<max ;i++  )
		{
			prime=isPrime(i);
			if (prime)
			{
				System.out.println(j + " : "+i+" is a prime.");
				j++;
			}
		}
		
	}

	
	private static boolean isPrime( int n)
	{
		for(int m=2; m<=Math.sqrt(n) ; m++ )		// prime part! 
		{
			if(0==n%m )		//if n is not divisible my m
				return false;
		}
		return true;
		
	}
}
